I made a script where theres a intvalue inside the player, and there is a game counter changing each time the value changes, but the way the points are recieved is by the player moving, so the points rapidly increase each by each one number, and i want to make it like this, kind of like how the numbers rapidly increase one by one in a roblox game when maybe you are getting closer to a location
I dont really know how to make this, as my script the points dont increase one by one and instead increase by 5 numbers or 9 numbers each time, but i want the game counter value to increase one by one, this my attempt at it
local player = game.Players.LocalPlayer
local tweenservice = game:GetService("TweenService")
local Points = player:WaitForChild("Points")
Points.Changed:Connect(function()
script.Parent.Text = tostring(Points.Value)
end)
local player = game.Players.LocalPlayer
local tweenservice = game:GetService("TweenService")
local Points = player:WaitForChild("Points")
while task.wait() do
script.Parent.Text = tostring(Points.Value)
end
i tried using it, but i got the same result as before
local player = game.Players.LocalPlayer
local tweenservice = game:GetService("TweenService")
local Points = player:WaitForChild("Points")
local player = game.Players.LocalPlayer
while task.wait() do
script.Parent.Text = tostring(Points.Value)
end
this is the script for adding the points, is the adding on to the value the reason why it doesnt add one by one?
local uis = game:GetService("UserInputService")
local walking = false
local stepswalked = 0
local player = game.Players.LocalPlayer
local points = player:WaitForChild("Points")
local multiplier = player:WaitForChild("PointMultiply")
local RunService = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local camera = game.Workspace.Camera
local Remotes = game.ReplicatedStorage:WaitForChild("Remotes")
local deathevent = Remotes:WaitForChild("DeathEvent")
local GetPointEvent = Remotes:WaitForChild("GetPoints")
local endevent = game.ReplicatedStorage.Remotes.EndEvent
local value = 0
local speedcheck = false
local LastPos = nil
while task.wait(0.3) do
local Char = Player.Character
if Char ~= nil then
local HumanoidRootPart = Char:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart ~= nil then
if LastPos == nil then
LastPos = Vector3.new(HumanoidRootPart.Position.X,0,0)
deathevent.OnClientEvent:Connect(function()
--from deathserver
LastPos = nil
end)
endevent.OnClientEvent:Connect(function()
--from endscript
LastPos = nil
end)
elseif LastPos ~= nil then
local NewPos = Vector3.new(HumanoidRootPart.Position.X,0,0)
if NewPos.X > LastPos.X then
local Distance = (NewPos - LastPos).Magnitude
if Distance >= 1 then
LastPos = NewPos
local ToAdd = (Distance * multiplier.Value)
points.Value += ToAdd
end
end
end
end
end
end
Yes, it doesn’t add 1 by 1 because you are multiplying the distance with a multiplier, and also you are checking if the distance is equal or more than 1, which will make the number bigger.