why does my script work on everyone but the player who activated it?
Hi there, you’ve gotta give us more info so we can help you. What is your script? What does it do? What is it supposed to do? etc.
script.Parent.Parent.Equipped:Connect(function(player)
game.StarterGui.ScreenGui.TextButton.Visible = true
game.StarterGui.ScreenGui.TextButton.MouseButton1Click:Connect(function()
local clone = game.ReplicatedStorage.bullet:Clone()
clone.Parent = workspace
local gun = script.Parent.Handle.Position
clone.Position = gun
end)
end)
script.Parent.Parent.Unequipped:Connect(function(player)
game.StarterGui.ScreenGui.TextButton.Visible = false
end)
the textbutton appears to the whole server but the player
You are changing the UI in StarterGui, not the UI that is in PlayerGui.
how do i change the players gui
To change the player GUI use: player.PlayerGui
Try this
script.Parent.Parent.Equipped:Connect(function(player)
player.PlayerGui.ScreenGui.TextButton.Visible = true
player.PlayerGui.ScreenGui.TextButton.MouseButton1Click:Connect(function()
local clone = game.ReplicatedStorage.bullet:Clone()
clone.Parent = workspace
local gun = script.Parent.Handle.Position
clone.Position = gun
end)
end)
script.Parent.Parent.Unequipped:Connect(function(player)
player.PlayerGui.ScreenGui.TextButton.Visible = false
end)
there is an error
PlayerGui is not a valid member of Mouse “Instance”
That’s because you don’t get the player from those functions if it’s a local script then do
local player = game:GetService("Players").LocalPlayer