Function(text,text) is all localplayer

I have tried searching the devforum for the issue but i could not find anything.

Localscript inside of the character

local s = game.Players.LocalPlayer.Character
local h = s:WaitForChild("Humanoid")
local plr = game.Players.LocalPlayer

h:GetPropertyChangedSignal("Sit"):Connect(function()
	if h.Sit == true then
		print("sitting")
		script.Parent.SeatOccupant.Value = true
		local lp = game.Players.LocalPlayer
		local target = lp:GetMouse()
		local t = target.Target
		game.ReplicatedStorage.TurretRemotes.MouseEvent:FireServer(lp, t)
	else
		warn("!nil!")
		script.Parent.SeatOccupant.Value = false
	end
	
end)

Server Script inside the seat (unfinished)

local seat = script.Parent

game.ReplicatedStorage.TurretRemotes.MouseEvent.OnServerEvent:Connect(function(lp, t)
	print("!!OCCUPANT!!")
			local TurretUnion = script.Parent.Parent.Guns
	print(lp)
	print(t)
			while wait() do
            local c = TurretUnion:GetPrimaryPartCFrame()
			TurretUnion:PivotTo(CFrame.new(c, t.Position))

		end
end)

output
image

t.Position is supposed to be the mouse.target.Position

Both parameters are the player because the player is a default parameter (You don’t have to send it).

local s = game.Players.LocalPlayer.Character
local h = s:WaitForChild("Humanoid")
local plr = game.Players.LocalPlayer

h:GetPropertyChangedSignal("Sit"):Connect(function()
	if h.Sit == true then
		print("sitting")
		script.Parent.SeatOccupant.Value = true
		local lp = game.Players.LocalPlayer
		local target = lp:GetMouse()
		local t = target.Target
		game.ReplicatedStorage.TurretRemotes.MouseEvent:FireServer(t)
	else
		warn("!nil!")
		script.Parent.SeatOccupant.Value = false
	end
	
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.