Trying to make a location switching thing

--Local Script
USER_INPUT_SERVICE.InputBegan:Connect(function(input, GPE)
	if GPE then return end
	if input.KeyCode == Enum.KeyCode.E then
		if TOOLENABLED == true then
			if game.Workspace.FX.ROOM:FindFirstChild("Room_Part") then
				if ROOMCOMPLETED == true then
					if SHAMBLESENABLED == true then
						SHAMBLESENABLED = false
						local mouseTarget = mouse.Target
						ShamblesActivationEvent:FireServer(mouseTarget)
						wait(SHAMBLESCOOLDOWN)
						SHAMBLESENABLED = true
					end
				end
			end
		end
	end
end)
ShamblesActivationEvent.OnServerEvent:Connect(function(Player, mouseTarget)
    local zoneGroup = game.Workspace.FX.ROOM
    local zone = Zone.new(zoneGroup)
    local isTargetWithinZoneBool = zone:findPart(mouseTarget)
    local isPlayerWithinZoneBool = zone:findPlayer(Player)
    if isTargetWithinZoneBool and isPlayerWithinZoneBool then
        if not mouseTarget.Parent:IsA("Accessory") then
            mouseTarget.Parent.HumanoidRootPart.Anchored = true
            mouseTarget.Parent.Humanoid.WalkSpeed = 0
            wait(.001)
            local EnemyLocation = mouseTarget.Parent.HumanoidRootPart.CFrame
            local PlayerLocation = Player.Character.HumanoidRootPart.CFrame
            Player.Character.HumanoidRootPart.CFrame = EnemyLocation
            mouseTarget.Parent.HumanoidRootPart.CFrame = PlayerLocation 
            mouseTarget.Parent.HumanoidRootPart.Anchored = false
            mouseTarget.Parent.Humanoid.WalkSpeed = 16
            print("Shambles")
        end
    end
end)

-- Server Side Script
ShamblesActivationEvent.OnServerEvent:Connect(function(Player, mouseTarget)
	Shambles:FireAllClients(Player, mouseTarget)
end)

Can anyone tell me why this has a weird delay on switching the locations of the player and the mouseTarget, and why sometimes it only moves one of them. EDIT: I’m pretty sure this is happening because I’m doing this on a local script, does anyone know of a way I could implement this into a server script with a remote event

why are you firing an event to everyone?
You just need to send a message to the server with the person, and literally swap the CFrames, You dont need to anchor or anything. Also the last script what message are you sending everyone?

I was going through the motions, all the other effects I did client-client, but I don’t this one needs to be done that way.

what are you sending to everyone when you did this?

I need details my man

1 Like

Ok so FOR ALL the effects in this tool, I make the parts show up on the client, by first firing a remote to the server, and then doing FireAllClients: back to the local script and making the efffects in there. For the zone module, It makes a region3 based on the parts made in the local script so it wasn’t working when I tried switching the teleportation to server side I just had an ephiphany so thank you for the help

I just fixed all of it, again thank you