But I did put the script into workspace and it still didn’t work, I don’t know what a server script is, never heard of it before.
Is the JoeMama part parented to anything other than workspace?
No it isn’t
30c sucks when u actually are saying something
I dont really know whats causing the problem then, but instead of referencing it like “workspace.JoeMama”, you could use “script.Parent”, since the script’s parent is the part itself.
anything wrong with this? there is still 2 red lines under then and the 2nd end, I got really confused with the brackets
The bracket at the “end” and “then” is not supposed to be there.
That is what I thought too, then is still underlined in red though
Just paste this and it should work:
local function onTouch(hit) if hit.Parent:FindFirstChild("Humanoid") then -- No bracket script.Parent.Anchored = false end end -- No bracket script.Parent.Touched:Connect(onTouch)
It works! Thanks for putting up with me.
Sorry for asking again, but if I wanted to make it so of you touch JoeMama, another Model would unanchor (like a painting). How would I do that?
I am trying to use this for my horror game, and I remember The Asylum had something like it.
Just modify the script to also unanchor the other part
So just do the same thing but add another part to unanchor.
Does it matter if Painting is a model?
Yes, models cant be unanchored, but the parts in them can, to do this you would use a for loop:
local paintingModel = workspace.Painting -- Example
for _, part in pairs(paintingModel:GetDescendants()) do -- We are looping through the model's children, and each child is assigned to "part"
if part.ClassName == "Part" then -- If the part is an actual part, set the anchored property to false
part.Anchored = false
end
end