I made this tool script, when you click the right arrow gui, the value will increase by 1, but this is not taking affect. Since it is parented in the player GUI, i tried using playergui for the variable but it’s not working. I also used Remote Events to call it from the server but this is still not taking any action. Any help is very appreciated!
Here is the script:
Client:
local plr = game.Players.LocalPlayer
local RightClick = plr:WaitForChild(“PlayerGui”).toolInformation.rightClick
local leftClick = plr:WaitForChild(“PlayerGui”).toolInformation.leftClick
local currentTool = plr:WaitForChild(“PlayerGui”).toolInformation.CurrentTool.Value
local RightEvent = game.ReplicatedStorage:WaitForChild(“LeftClick”)
local shop = game.ReplicatedStorage:WaitForChild(“Shop”)
local tweenService = game:GetService(“TweenService”)
local camera = workspace.CurrentCamera
local maximumItem = 9
camera.CameraType = “Scriptable”
RightClick.MouseButton1Click:Connect(function()
RightEvent:FireServer(currentTool)
local tween = tweenService:Create(
camera,
TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0),
{
CFrame = workspace:WaitForChild(“cp”…currentTool).CFrame,
Focus = workspace:WaitForChild(“cp”…currentTool).CFrame
}
)
tween:Play()
end)
Server:
game.ReplicatedStorage:WaitForChild(“RightClick”).OnServerEvent:Connect(function(plr, maximumItem)
local currentTool = plr:WaitForChild(“PlayerGui”).toolInformation.CurrentTool.Value
if currentTool < maximumItem then
currentTool = currentTool + 1
end
end)