when i touch the part it neither kills me or opens the door no matter what rank i got local script:
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.leaderstats.Rank.Value >= 5 then
script.Parent.Parent.Script.Disabled = false
end
end)
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.leaderstats.Rank.Value < 5 then
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end
end)
i changed this to a server script but now i cant index the local players stats, help

7 comments
I'm 99% sure that you can't use local scripts outside of playergui, backpack, playerscripts, replicated first and player’s character
u can
local scripts r being used alot in workspace if something is just gonna be shows for the local player
You can simply check this https://developer.roblox.com/api-reference/class/LocalScript , its stated that local scripts don't run outside of playergui, backpack, playerscripts, replicated first and player’s character
well u understand that wrong because they do, we got a car script that usess a local script and it runs fine
It legit says "A LocalScript will only run Lua code if it is a descendant of one of the following objects: A Player’s Backpack, such as a child of a Tool A Player’s Player/Character|character model A Player’s PlayerGui A Player’s PlayerScripts. The ReplicatedFirst service". I don't know what type of a car you use with local script but its not even remotely imaginable
i litterly have another script here that is a local script, doesnt use a server script and it does this https://vimeo.com/331561535