✓ Accepted answer
You're doing this on the Server, therefore any changes in that script all players will see. You need to make it so it's on the client side. You can do that via a Local Script and RemoteEvents.
First add a RemoteEvent into ReplicatedStorage. And because you're adding player stats, you'll need to do that server side, so you can add another script and putting it in ServerScriptService and also add another RemoteEvent and call it 'GiveStrengthOnTouch' or anything you want.
Then add this to you Server Script:
script.Parent.Touched:Connect(function(hit)
local Character = hit.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
if Character:FindFirstChild("Humanoid") ~= nil then
game.ReplicatedStorage.RemoteEvent:FireClient(Player)
end
end)
Local Script:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(player)
local db = true
if db == true then
db = false
script.parent.Transparency = 0
game.ReplicatedStorage.GiveStrengthOnTouch:FireServer()
script.parent.BackDecal.Transparency = 0.7
script.parent.FrontDecal.Transparency = 0.7
wait(3)
db = true
script.parent.Transparency = 0
script.parent.BackDecal.Transparency = 0
script.parent.FrontDecal.Transparency = 0
end
end)
Then the script to give the player the Strength:
game.ReplicatedStorage.GiveStrengthOnTouch.OnServerEvent:Connect(function(player)
player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 100
end)
I do apologise if this does not work for you. I hope you get the idea of it anyway.
2 comments
all you need to do it create the coins locally for the player instead of using server resources
i can't understand how