Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i reference the player without a function?

so basically i need to reference X,Y,Z coordinates but i also need the player the problem is the player gets mixed with the Z coordinates and when i print it it says "jedistuff2,(my Y coordinates), (My X coordinates)



	game.ReplicatedStorage.CoordinatesX.OnServerEvent:Connect(function(X)
		game.ReplicatedStorage.CoordinatesY.OnServerEvent:Connect(function(Y)
		game.ReplicatedStorage.CoordinatesZ.OnServerEvent:Connect(function(Z)
			game.ReplicatedStorage.FloorPlace.OnServerEvent:Connect(function(Player)

	local Floor = Instance.new("Part", workspace)
	local FloorSize = Vector3.new(X, Y, Z)
	Floor.Name = "Floor"
	Floor.Size = FloorSize
	Floor.CFrame = CFrame.new(Player.Character["Left Leg"].Position) + Vector3.new(0,-1,0) 
	Floor.Anchored = true
	Floor.BrickColor = BrickColor.new("Pastel brown")
		Floor.Material = Enum.Material.WoodPlanks
		print(X,Y,Z)



	end)
	end)
	end)
	end)

heres the local script too


local Button = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
Button.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.FloorPlace:FireServer()
	game.ReplicatedStorage.CoordinatesX:FireServer(script.Parent.X.Text)
	game.ReplicatedStorage.CoordinatesY:FireServer(script.Parent.Y.Text)
	game.ReplicatedStorage.CoordinatesZ:FireServer(script.Parent.Z.Text)
	
end)

1 comment

0

The first remote event parameter is the player,thats may be why

1 answer

The first parameter of any remote event when received on the server side is the player, you need to separate the variables something like this:

game.ReplicatedStorage.CoordinatesX.OnServerEvent:Connect(function(player, X)

end)

Also i'd recommend sending all variables in a single event

game.ReplicatedStorage.CoordinatesX.OnServerEvent:Connect(function(player, X, Y, Z)
end)

1 comment

0

thanks ill try it

This discussion is preserved as it was. New answers, comments, and votes are closed.