Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i reference the player without a function?

Asked by 4 years ago

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)
0
The first remote event parameter is the player,thats may be why yuni_Boy1234 320 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
0
thanks ill try it jedistuff2 89 — 4y
Ad

Answer this question