You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I’m trying to make a model move from ReplicatedStorage to Workspace.
What is the issue? Include screenshots / videos if possible!
For some weird reason it says that Line 5 is the problem in my output.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local ShipValue = player:WaitForChild("SpaceShipValue") --Line 5
ShipValue.Changed:Connect(function() -- Fires whenever the time value in workspace changes
if ShipValue.Value == 1 then
local Clone = ReplicatedStorage.Spaceship:Clone() -- Clones the map from replicated storage
Clone.Parent = game.Workspace -- Places the cloned map in workspace
end
end)
I’ve tried it and it works perfectly. This might be an error with changing the ShipValue. You’ve stated that it fires when the time value in workspace changes, but you defined the ShipValue’s location inside the player.
If that’s what your trying to achieve yes. If the ShipValue is located in workspace and not the player then it will give an error because you defined it inside the player. Also make sure that the value actually changes for the event to fire and that the value meets your conditions == 1.
Okay well. I put the value inside the player, and it still says that line 5 isn’t working. It’s not in the workspace and it’s in the player this time. I have tried so many things to fix it and it keeps telling me that Line 5 is always the problem.
Are you running this code inside of a ServerScript? Because if you are, you cannot access game.Players.LocalPlayer from a ServerScript as you can only access it on the client, not the server.
EDIT: I did not read the post above me, sorry if this looks like a repost.