Hey!! I am trying to make an old style shop where you walk into a part and if you have enough "Cash" then you can go past, if not, nothing happens. Here is my local script in the part
`local leaderstarts = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Cash") local part = script.Parent local function OnTouch(part) if leaderstarts.Value >= 10 then script.Parent.Transparency = 1 script.Parent.CanCollide = false print("Your not poor") else print("Wow your poor") end
end`
Locals scripts don't work when it is in a part on workspace I think. What I've done here is you put the part that you want to walk through and put it in ReplicatedStorage. Create a local script and put it in StarterGui.
local leaderstarts = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Cash") local part = game.ReplicatedStorage.Part -- Gets the part from replicated local clone = part:Clone() -- Clones all individial local parts to each player clone.Parent = workspace db = false clone.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if db == false then db = true local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr.leaderstats.Cash.Value >= 10 then clone.Transparency = 1 clone.CanCollide = false print("Your not poor") wait(1) -- Adjust time to extend the duration of the opening clone.Transparency = 0 clone.CanCollide = true db = false else print("Wow your poor") end end end end)
See if that works. Also, what is happening is cloning the part in the ReplicatedStorage and clones to players individually which only makes the part transparent locally.