I will test it and see if everything works fine.
Is the script okay in StarterPlayerScripts?
The local script should probably be with the gui, and the server script in server script storage.
Like this ?
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Money"
money.Value = 0
money.Parent = leaderstats
end)
RemoteEvent.OnServerEvent:Connect(function(Player)
Player.leaderstats.money.Value -= 5
end)
I think that will work for the server script, and the local script should be in the Gui.
money is not a valid member of Folder “Players.docega075.leaderstats”
LocalScript Button :
local GUI = script.Parent
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
GUI.Activated:Connect(function()
RemoteEvent:FireServer()
end)
ScriptService
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Money"
money.Value = 0
money.Parent = leaderstats
end)
RemoteEvent.OnServerEvent:Connect(function(Player)
Player.leaderstats.money.Value -= 5
end)
Oh, change
to
Player.leaderstats.Money.Value -= 5
Should I call player? in my script??
I’m going to go test it all out.
What do you mean, you mean the Player.leaderstats.Money.Value -= 5 should be player.leaderstats.Money.Value? I don’t think so.
OH IT WORKS !!, Really thank you very much for your help, you took the time to answer me and tried to help me as much as possible, frankly continue your good work thank you for having saved so much time for me. Thank you very much I don’t know how to thank you but thank you very much.
No problem, if you have any other questions feel free to ask. Good luck on your project. See you!
Thanks you very very much. for help
what if you do it like this:
local remote = game.ReplicatedStorage:WaitForChild("RemoteEventNew")
script.Parent.MouseButton1Click:Connect(Function()
remote:FireServer()
end)
My opinion is that to obtain a replicated Storage service from the client it is not correct to obtain it normally without GetService
but you could also change the name of the Remote Event maybe that will help
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.