it only prints these two Hi’s
Make sure to give yourself enough coins.
um i had 2.5k coins so i dont knwo why it didnt work
Is there any related error(s)? And does the leaderstats exist in the player?
leaderstats do exist in player
Please screenshot the entire leaderstats.
Now when i touch it only prints this Hi
Open the leaderstats folder and screenshot its children.
Does the remote event exist in ReplicatedStorage?
YEs it does
Try using game:GetService(“ReplicatedStorage”). Events:WaitForChild(“Buy”)
Make each print() outputs different results.
And add a few seconds of delay at the start of the script.
I recommend just making a DataStore for what doors the player owns, and then the player auto-invokes server on join, and the server returns if the player owns it or not, if they do, it destroys the door, if they don’t, it keeps the door. To make better protection, have a big part in each zone ( area you enter after the door ) , every time it is touched, it checks if the player owns the door to that zone, if they don’t, and exploited to get there, then make their Health 0.
yea ik about that,but it wotn let me purchase the zone
Are there any errors currently that are displayed? Remove all the print statements, so the errors are more clear ( if any ). Before debugging, we look for errors.
local Buy = game:GetService("ReplicatedStorage").Events:WaitForChild("Buy")
local db = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if db == false then
db = true
if player.leaderstats.Coins.Value >= 1250 then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 1250
Buy:FireClient(player)
wait(.2)
db = false
end
end
end
end)
Heres the local script for the Buy Events
local yourRemote = game.ReplicatedStorage.Events.Buy
yourRemote.OnClientEvent:Connect(function()
local Player = game.Players.LocalPlayer
game.Workspace.Snow:Destroy()
end)
local yourRemote2 = game.ReplicatedStorage.Events.Buy2
yourRemote2.OnClientEvent:Connect(function()
local Player = game.Players.LocalPlayer
game.Workspace.DesertDoor:Destroy()
end)
local yourRemote3 = game.ReplicatedStorage.Events.Buy3
yourRemote3.OnClientEvent:Connect(function()
local Player = game.Players.LocalPlayer
game.Workspace.Snow1:Destroy()
end)