Here is the script: script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Parent.Parent.Parent.PartZero.Motor.DesiredAngle = -1.5 end)
It says PartZero is not a valid member of player ;-; what does this mean?
Here is the script: script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Parent.Parent.Parent.PartZero.Motor.DesiredAngle = -1.5 end)
It says PartZero is not a valid member of player ;-; what does this mean?
It's good practice to only have one script for the local player and the server.
Having a hundred scripts that only handle a single button is very messy and makes it harder to edit, update and correct things later.
That aside,
It appears that you are searching for "PartZero", however the part's name is changed to "Rotator" and as such the script can't account for it.
Given the lack of information about how it's structured I'll suggest this:
--Parent the script to the ScreenGui for neater code (Should really be in PlayerGui but that aside)
script.Parent = game.Players.LocalPlayer.PlayerGui.ScreenGui
local PartZero = game.Players.LocalPlayer.PartZero
local OpenButton = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Open
OpenButton.MouseButton1Click:Connect(function()
PartZero.Motor.DesiredAngle = -1.5
end)
This is assuming of course that the "PartZero" is located in the player based on what little information you have provided. It really shouldn't be in there, this might be the problem. Assuming it is the problem simply change the location for PartZero to where it actually is located.
If the part is in the workspace, then you need to check if the game is FilteringEnabled. If it isn't, then you can simply change the PartZero variable to workspace.PartZero If it is, then you'll need to handle it with a event. Like so:
--Server Script
local PartZero = workspace.PartZero
game.ReplicatedStorage.MotorChange.OnServerEvent:Connect(function(player)
PartZero.Motor.DesiredAngle = -1.5
end)
--Local Script
local OpenButton = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Open
local ButtonDelay = 0.1 --Cooldown for the button
local Debounce = false
OpenButton.MouseButton1Click:Connect(function()
if Debounce == false then
Debounce = true
game.ReplicatedStorage.MotorChange.FireServer()
wait(ButtonDelay)
Debounce = false
end
end)
If this is unhelpful, then more information may be required.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Also here is what it says in the output: 22:24:35.535 - Rotator is not a valid member of Player 22:24:35.537 - Stack Begin 22:24:35.539 - Script 'Players.Developer_Hunter.PlayerGui.ScreenGui.Frame.Open.Script', Line 2 22:24:35.540 - Stack End (The partzero name switched to Rotator)
Would you mind putting the script in the Lua Code block format next time? Just makes it easier to read.