I’m trying to figure out how to make this part CanCollide set to false after rejoining when having a boolvalue set to true, but It doesn’t work and I don’t know the issue with the code, It’s a local script in StarterPlayerScript.
Here’s the code:
local worldblock = game.Workspace:WaitForChild("World1block")
game.Players.PlayerAdded:Connect(function(player)
if player.Worlds.World2.Value == true then
worldblock.CanCollide = false
end
end)
(Assuming you have another script that turns the world2 value to true)
If the default value of World2 is false when you join the game, then you might be checking the condition before the value could have time to change to true.
If that’s not the case, then refer to the answers above.
I got it to work after changing the script, but it wouldnt print anything in a studio game which left me confused on why it didnt even print anything when the player had join, only in a local server inside the studio, not sure why?
local worldblock = game.Workspace:WaitForChild("World1block")
local prompt = workspace:WaitForChild("BuyPromptWorld1").ProximityPrompt
game.Players.PlayerAdded:Connect(function(player)
print("joined")
wait(2)
if game.Players.LocalPlayer.Worlds.World2.Value == true then
print("wadwasdwa")
worldblock.CanCollide = false
prompt:Destroy()
end
end)