I’m trying to make a script that will have the position of this part change but only locally, so that it doesn’t affect other clients. My problem is that I can only change the position of the part for the entire server (yes it works), but if I try it in a local script, it fails completely. Here’s the script:
local debounce = false
game.Workspace["Start and End1"].Start.Touched:Connect(function()
if not debounce then
debounce = true
local randomX = math.random(1, 2048)
local randomZ = math.random(1, 2048)
script.Parent.Position = Vector3.new(randomX / 2.25, 1016.069, randomZ / 2.25)
script.Parent.Parent.EndExtra.Position = Vector3.new(script.Parent.Position.X, 3063.069, script.Parent.Position.Z)
script.Parent.Transparency = 0
script.Parent.Parent.EndExtra.Transparency = 0
end
end)
script.Parent.Touched:Connect(function(hit)
debounce = false
local ground = hit.Parent.Humanoid.FloorMaterial
if ground ~= Enum.Material.Air then
game.ReplicatedStorage.EndRound:FireClient(game.Players:FindFirstChild(hit.Parent.Name))
script.Parent.Transparency = 1
hit.Parent.Humanoid.Health = 0
end
end)
What am I doing wrong and how can I fix this?