Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to fix a value giver for my game?i tried a local and a normal script?


local sound = game.SoundService.Sound
while true do
	sound:Play()
	wait(sound.TimeLength)
local exp=Instance.new("Explosion")
exp.Position=script.Parent.Position
exp.Parent=workspace
exp.BlastRadius = 20000
exp.BlastPressure = 100000000
game.Players.LocalPlayer.leaderstats.ThanosCoin = game.Players.LocalPlayer.leaderstats.ThanosCoin + 10
end


this is what i made i think i need to use remote events but i dont know how?

1 answer

✓ Accepted answer

To use remote events you need a localscript and a global script and a remote

add a remote event to replicated storage as well named AddThanosCoin

Local Script

local sound = game.SoundService.Sound
while true do
    sound:Play()
    wait(sound.TimeLength)
local exp=Instance.new("Explosion")
exp.Position=script.Parent.Position
exp.Parent=workspace
exp.BlastRadius = 20000
exp.BlastPressure = 100000000
game.ReplicatedStorage.AddThanosCoin:FireServer()
end

Server Script

game.ReplicatedStorage.AddThanosCoin.OnServerEvent:Connect(function(plr)

game.Players[plr].leaderstats.ThanosCoin = game.Players[plr].leaderstats.ThanosCoin + 10
end

This discussion is preserved as it was. New answers, comments, and votes are closed.