Hey guys im working on a bunch of buyable custom deaths so when you die you turn into a gravestone or something stupid like that. Anyway I’m trying to get it to change the player’s “chosendeath” value by firing a remote event from a imagebutton into a startercharacterscripts script. I’ve been stuck on this for a while.
localscript:
plr = game.Players.LocalPlayer
debounce=false
function onActivate()
if debounce==false then
debounce=true
print(“made it this far”)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,8643869) then
game.ReplicatedStorage.remotes.changeDeath:FireServer(1)
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,8643869)
end
wait(1)
debounce=false
end
end
plr:WaitForChild(“HiddenStats”)
chosendeath = plr.HiddenStats:WaitForChild(“SelectedDeath”)
if(chosendeath.Value==1) then
script.Parent.BackgroundColor3=Color3.new(13/255,50/255,104/255)
else
script.Parent.BackgroundColor3=Color3.new(48/255,113/255,255/255)
end
function onchange()
if(chosendeath.Value==1) then
script.Parent.BackgroundColor3=Color3.new(13/255,50/255,104/255)
else
script.Parent.BackgroundColor3=Color3.new(48/255,113/255,255/255)
end
end
chosendeath.Changed:Connect(onchange)
script.Parent.Activated:Connect(onActivate)
script:
plr = game.Players:GetPlayerFromCharacter(script.Parent)
plr:WaitForChild(“HiddenStats”)
chosendeath = plr.HiddenStats:WaitForChild(“SelectedDeath”)
wait(1)
function onevent(plr,choice)
print(“the choice is”… choice)
plr.HiddenStats.SelectedDeath.Value=choice
end
if plr.HiddenStats.SelectedDeath.Value==0 then
return
end
if plr.HiddenStats.SelectedDeath.Value==1 then
script.Parent.antigrav.Disabled=false
end
if plr.HiddenStats.SelectedDeath.Value==2 then
script.Parent.gravestone.Disabled=false
end
if plr.HiddenStats.SelectedDeath.Value==3 then
script.Parent.easteregg.Disabled=false
end
game.ReplicatedStorage.remotes.changeDeath.OnServerEvent:Connect(onevent)