#My script for making a model disappear not working

1 messages · Page 1 of 1 (latest)

flint trellis
#

I'm trying to script my model disappear when a player steps on it, but for individual players so people can troll other players if they step on it. The script I used doesn't work 😭 and I've tried like 5 new scripts and none of them work.. any help on this?

chilly oracle
#

Where is the script

flint trellis
#

I had to delete it cause it was in my model script, and I should of put it in the starterplayerscript but it was too late as i already deleted it

chilly oracle
#

Put a script in your model:
local part = script.Parent
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
part.CanCollide = false
end
end)

flint trellis
#

done

chilly oracle
#

Did it work

flint trellis
#

:c no

#

i try looking online for other forums to see if someone had posted the same thing im doing but its all for global

chilly oracle
#

Why would u want it to be individual

flint trellis
#

so players cant troll other players when doing the obby

chilly oracle
#

Then do it in a localscript

flint trellis
#

alrighttt

rare thistle
maiden plover
#

what about script.Parent.Touched:Connect(function()
task.wait(0.5)
script.Parent.CanCollide = false
end)

quiet egretBOT
#

studio** You are now Level 1! **studio

chilly oracle
#

Thats why i didnt put

#

And that is just a part. Since theres a lot of platforms you would need collection service and tween its transparency. @flint trellis

dapper junco
#

lol

chilly oracle
#

If you set transparency and cancollide instantly then the player wouldnt even have time to jump again before the platform disappears

dapper junco
#

wat are u even saying 💔

flint trellis
quiet egretBOT
#

studio** You are now Level 2! **studio

dapper junco
#

cancolide would be as instant as transpanecy all it means is they act know if its gone or not

#

wtf are you on

#

imagine a player jumps on a part and they fall through it and they dont know why

#

💀

chilly oracle
#

Thats why i said to use tweening wtf are u on

flint trellis
#

yallll chillll its all goodd

dapper junco
chilly oracle
#

And set cancollide to false after tween is completed

dapper junco
chilly oracle
#

How else would you make it slowly disappear

flint trellis
#

its just for my obby game 3844catcry

dapper junco
#

you dont need to slowly make it disapear

dapper junco
chilly oracle
#

Oh wait this is a rage bait

dapper junco
#

part is invisible for so long wait part goes inviisble/cancolide off repeat

#

you can tween if you want to but its unessessary

steep bobcat
#

hi

dapper junco
#

espically if its a beginner

steep bobcat
#

can u guys help me

dapper junco
#

surr

steep bobcat
#

its witth cmdr

#

to set t up

flint trellis
#

SChappy create ur own post?

dapper junco
flint trellis
chilly oracle
#

repeat part.Transparency +=0.1
until part.Transparency = 1
part.CanCollide = false
If thats what youre saying but still use collectionservice

dapper junco
#

You could fact check me but pretty sure u need to make player sided objects or smth

#

otherwise server script would only work pretty sure

#

or im cooked

flint trellis
#

he also sent me a script to paste in there, sending it rn

dapper junco
flint trellis
#

-- LocalScript inside StarterPlayerScripts

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Folder in Workspace with all ghost models
local ghostFolder = workspace:WaitForChild("Pixel ghost fading parkcore")

-- Hide originals so they don’t interfere
for _, model in ipairs(ghostFolder:GetChildren()) do
if model:IsA("Model") then
local part = model:FindFirstChild("Pixel ghost fade away")
if part and part:IsA("BasePart") then
part.Transparency = 1
part.CanCollide = false
part.CanTouch = false
end
end
end

-- Function to fade a part
local function fadePart(part)
-- Fade out
for i = 0, 1, 0.1 do
part.Transparency = i
task.wait(0.05)
end
part.CanCollide = false

-- Respawn after delay
task.wait(3)
part.Transparency = 0
part.CanCollide = true

end

-- Clone and set up local ghosts
for _, model in ipairs(ghostFolder:GetChildren()) do
if model:IsA("Model") then
local part = model:FindFirstChild("Pixel ghost fade away")
if part and part:IsA("BasePart") then
local clone = part:Clone()
clone.Parent = workspace
clone.CFrame = part.CFrame
clone.Anchored = true
clone.CanCollide = true
clone.CanTouch = true

        -- Detect stepping
        clone.Touched:Connect(function(hit)
            if hit.Parent == character then
                if not clone:GetAttribute("Disappearing") then
                    clone:SetAttribute("Disappearing", true)
                    fadePart(clone)
                    clone:SetAttribute("Disappearing", false)
                end
            end
        end)
    end
end

end

#

this is what he told me to paste, does not work

chilly oracle
#

Ok this is definitly ai and your for , model in ipairs(ghostFolder:GetChildren()) do is is incomplete

#

There is no indexname

flint trellis
#

wait its AI????

#

bruh.

dapper junco
#

0.0

dapper junco
chilly oracle
#

Localscripts obviously

dapper junco
#

🤦

dapper junco
chilly oracle
#

By client objects u mean parts only seen by client i assume

dapper junco
#

yes

flint trellis
dapper junco
#

r all ur parts in that folder?

flint trellis
chilly oracle
dapper junco
#

😔

dapper junco
#

oh starterplayer

#

lol

#

try startergui

#

oh its the samw

flint trellis
dapper junco
#

ngl yeah it looks like the script doesnt work

#

😔

chilly oracle
#

Your for loop when you iterate over a table is wrong

dapper junco
chilly oracle
#

Ok your ai code is completely wrong.

#

It is searching for a BasePart

#

Which from your screenshot is it a union

#

And your for , in model:GetChildren() there are no variable before and after the comma

#

Which will error

#

You need the index variable if youre iterating in a table

#

@flint trellis

#

It randomly gets the model

#

Which the model variable does not exists

#

Add i, model in ghostFolder:GetChildren()

dapper junco
# flint trellis <a:3844catcry:1269024624814063707>

If ur a builder thats fine ig but if you wana learn stuff lemmy know I can add comments to it.

||```
local folder = game.ReplicatedStorage.replacemewithfoldername
local debounce = false

-- Function to fade a part
local function fadePart(part)
if debounce == true then
return
end
debounce = true

-- Fade out
for i = 0, 1, 0.1 do
    part.Transparency = i
    task.wait(0.05)
end
part.CanCollide = false

-- Respawn after delay
task.wait(3)
part.Transparency = 0
part.CanCollide = true
debounce = false

end

for _,i in folder:GetChildren() do
if i:IsA('Model') == false then
return
end

local clone
for _,i in i:GetChildren() do
    clone = i:Clone()
    clone.Parent = workspace
end

function ontouched(hit)
    if hit.Name == 'Handle' then
        return 
    end
    
    if hit.parent:IsA('Model') then
        fadePart(clone)
    end
end

clone.touched:connect(ontouched)

end

#

Put the folder in replicatedstorage when you wana test and when u building put it in workspace so you can see it

flint trellis
quiet egretBOT
#

studio** You are now Level 3! **studio

dapper junco
#

This is the first episode and beginning to become a Roblox Scripter/Game Developer! With 3 playlists (Beginner, Advanced, GUI) containing 50+ videos and 30+ hours of content, I will guide you through this journey to start making the games you want to create on Roblox!

DISCORD 📜
Join my Discord Community if you want scripting help, participat...

▶ Play video
dapper junco
flint trellis
dapper junco
#

Also fyi stay away from pasting stuff you don't understand

#

like if you paste a 100 line script and you dont know anything like thats cooked

flint trellis
#

Now I have only my models I built in my game

dapper junco
quiet egretBOT
#

studio** You are now Level 6! **studio

dapper junco
flint trellis
#

Im much better with building it’s more fun but the scripting just hurts my head

dapper junco
#

well you cannot jump from 0 to 100

#

👁️

#

it js takes time like building, scripting has more obvious progress doe

#

in my opinion