Hello, I am trying to make a script in which the player kicks a ball but the shot power value goes to everyone in the server. But I want to know how to make the value exclusive to the player. This is my code
local hitbox = game.Workspace.football.hitbox
local ball = hitbox.Parent
local rs = game:GetService("ReplicatedStorage")
local re1 = rs:FindFirstChild("FireHolding")
local re2 = rs:FindFirstChild("FireShotPower")
local re3 = rs:FindFirstChild("FireShotPower2")
local re4 = rs:FindFirstChild("FireRunning")
local dribbleSFX = hitbox["Football Dribble"]
local shotSFX = hitbox["Football Shoot"]
local shotpower = 1
local dribblepower = 25
local height = 35
local shotadd = 2
local runservice = game:GetService("RunService")
local holding = false
local deb = false
re4.OnServerEvent:Connect(function(Player, running)
if running then
if shotpower == 1 then
dribblepower = 35
end
if shotpower > 1 then
if shotpower < 2.75 then
dribblepower = 70
height = 0
end
if shotpower > 2.75 then
dribblepower = 40
height = 20
end
end
shotadd = 2
end
if not running then
if shotpower == 1 then
height = 20
end
if shotpower > 1 then
if shotpower < 2.75 then
dribblepower = 60
height = 0
end
if shotpower > 2.75 then
dribblepower = 20
height = 35
end
end
if shotpower == 1 then
dribblepower = 15
end
shotadd = 1.5
end
end)
-- quadrant is 1 + 0.875
hitbox.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
local playerCharacter = hit.Parent
local hrp = hum.Parent:FindFirstChild("HumanoidRootPart")
local cf = hrp.CFrame
local lookvector = cf.LookVector
if deb == false then
ball.AssemblyLinearVelocity = Vector3.new(lookvector.x * dribblepower * (shotpower * shotadd), 1 * (shotpower * height), lookvector.z * dribblepower * (shotpower * shotadd))
if shotpower == 1 then
dribbleSFX:Play()
end
deb = true
if shotpower > 1 then
re2:FireAllClients(shotpower)
shotSFX.Volume = shotpower / 3
shotSFX:Play()
end
wait(0.5)
deb = false
end
end
end)
re1.OnServerEvent:Connect(function(player, newHoldingValue)
holding = newHoldingValue
end)
while true do
if holding == true then
if shotpower < 3.5 then
shotpower = shotpower + 0.06
re3:FireAllClients(shotpower)
end
end
if holding == false then
shotpower = 1
re3:FireAllClients(shotpower)
end
task.wait(0.0001)
end
I’ve tried using player number values but after 30 minutes I couldn’t get it working. And yes the script is a server script but this is clearly a problem. And i need to tinker it without messing up the remote events I have.