Ad
Log in to vote
1

Script not running at all not even prints?

Asked by
MattVSNNL 614 Moderation Voter
10 months ago

So I made a script that will detect when it's a door it shows a little gui to interact, But my code isn't even running, Even prints on the top isn't working, Can anyone help me, Literally any code will not run at all, It might also be the fact it's in replicatedStorage, Can anyone help?

game:GetService("Players").PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)

        for _, v in pairs(workspace:GetDescendants()) do
            if v:FindFirstChild("Interactable") then

                local magnitude = (v.Position - char:FindFirstChild("HumanoidRootPart").Position).magnitude

                print(magnitude)

                if magnitude <= script.Parent:FindFirstChild("InteractGui"):FindFirstChild("InteractBoard").MaxDistance then

                    print("In sight!")

                    local newGui = script.Parent:FindFirstChild("InteractGui"):Clone()
                    newGui.Parent = player:WaitForChild("PlayerGui")

                    newGui:WaitForChild("InteractBoard").Adornee = v

                else
                    if player:WaitForChild("PlayerGui"):FindFirstChild("InteractGui") then

                        print("Got out of sight!")

                        player:WaitForChild("PlayerGui"):FindFirstChild("InteractGui"):Destroy()

                    else

                        print("Never was in sight!")

                    end
                end
            end
        end     

    end)
end)
2
Nvm scripts don't run inside replicatedStorage MattVSNNL 614 — 10mo
0
~facepalm~ NickyPlayz2011 82 — 10mo
0
lol NGC4637 602 — 10mo
0
xDDDDD MattVSNNL 614 — 10mo

Answer this question