Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
hokyboy 270 Moderation Voter
4 years ago

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

Log in to vote
0
Answered by
danglt 185
4 years ago
Edited 4 years ago

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
Ad

Answer this question