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

never-mind i actually fixed it! ?

its fixed i used my brain to fix it

1 comment

0

U cannot use local player in normal script (Also local script won't run on ServerScriptService)

1 answer

Issues

  • You're trying to index LocalPlayer, which does not exist in the server. You'd want to replace game.Players.LocalPlayer. It's redundant due to the fact that you've already defined player, as it was given as the first parameter to the OnServerEvent event connection function.
  • RemoteEvents shouldn't be in Lighting, but rather ReplicatedStorage
  • There's no such thing as findFirstChild. ROBLOX uses PascalCase, not camelCase. It should be FindFirstChild
  • You should be using HumanoidRootPart if you want R15 compatibility.
  • You're using the CFrame object constructor function incorrectly. In your case, there's no need to get involved with CFrames. You should just use Vector3
  • It's a good practice to use the WaitForChild and GetService functions, instead of just indexing instances with the desired child.

Solution

local ToolEvent = game:GetService("ReplicatedStorage"):WaitForChild("ToolEvent")

ToolEvent.OnServerEvent:Connect(function(Player)
	local character = player.Character
	if character and character:FindFirstChild("HumanoidRootPart") then
		character.HumanoidRootPart.Position = Vector3.new(-63.84, 18.95, 37.718)
	end
end)

3 comments

0

Thanks for trying but still the same error :/

0

I need to get the fired event which means it needs to stay in sss but then i also need the char so idk howww

0

i fixed it by my self its fine

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