I'm trying to make an extra point system for a simulator where you jump to die to get points also all of these are local scripts. The main part that doesn't work is the datastore part.
local player = game.Players.LocalPlayer
if script.Parent.Head.Dialog.DialogChoice then
if player.leaderstats.Points >= 5 then
player.leaderstats.Points = player.leaderstats.Points - 5
player.ExtraPoints.Value = true
end
end
local datastore = game:GetService("DataStoreService")\
local ds2 = datastore:GetDataStore("ExtraPoints")
local ExtraPoints = Instance.new("BoolValue", plr)
ExtraPoints.Name = "ExtraPoints"
ExtraPoints.Value = ds2:GetAsync(plr.UserId) or false
ds2:SetAsync(plr.UserId, ExtraPoints.Value)
ExtraPoints.Changed:connect(function()
ds2:SetAsync(plr.UserId, ExtraPoints.Value)
end)
end)
local debounce = false
local character = game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
if not debounce then
character.Humanoid.Health = 0
if player.ExtraPoints.Value == true then
player.leaderstats.Points.Value = player.leaderstats.Points.Value +4
end
elseif player.ExtraPoints.Value == false then
player.leaderstats.Points.Value = player.leaderstats.Points.Value +2
end
debounce = true
wait(9)
debounce = false
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.Space)

2 comments
Which part of it doesn't work?
well there kinda all tied together but the main part that doesnt work is the datastore part