Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved] Detecting if something is in workspace does not work?

Asked by 2 years ago
Edited by greatneil80 2 years ago

So I have a script where if you click a button a RemoteEvent fires and an object is summoned to Workspace. Everything works except the "if bert.Parent == workspace". The object is cloned to workspace but the script does not detect when it enters workspace. Help?

local bert = game.ReplicatedStorage:WaitForChild("bigcat",math.huge)

local BertIsComing = game.ReplicatedStorage.TheBertisComing

local tweenService = game:GetService("TweenService")

local goal = {}
goal.Position = Vector3.new(-35.828,595.983,-14.649) 

local tweenInfo = TweenInfo.new(1) 

local tween = tweenService:Create(bert, tweenInfo, goal) 

if bert.Parent == workspace then
    print("Bert has entered workspace")
    BertIsComing:Play()
    wait(5)
    msg = Instance.new("Message",workspace)
    msg.Text = "Bert has been summoned, the world is doomed"
    tween:Play()
    print("OUR LORD AND SAVIOR, BERT HAS BEEN SUMMONED, ALL HAIL BERT")

    tween.Completed:Connect(function()
        for i,v in pairs(game:GetService("Players"):GetPlayers()) do
            v:Kick("Nothing remains in this world")
        end
    end)
end
0
the cloning and parenting to workspace should be within lines 2-13, the bert you are indexing is in replicated storage, the clone isn't that same bert. greatneil80 2647 — 2y
0
Thank you! Leave an answer below so I can mark it as an answer @greatneil80 Velocityok 36 — 2y
0
I figured it out now, instead of making a separate script, I just got the server side script with the OnServerEvent and just implemented it there Velocityok 36 — 2y
0
epic, ill mark this as answered greatneil80 2647 — 2y

Answer this question