I made this code, but it only prints “Working”, but when activated it does not print “Activated” like it’s supposed to. I have restarted studio too, and it note that the code does not work in the normal roblox app either. The script randomly stopped working. It also does not have any errors in output when activated.
script:
local Tool = script.Parent
print("Working")
local function ActivateTool()
print("Activated")
local Char = script.Parent.Parent
local Player = game.Players:FindFirstChild(Char.Name)
if workspace:FindFirstChild(Player.Name .. " Vehicle " ) then
else
local Truck = game.ServerStorage.SpawnableCars:FindFirstChild(script.Parent.Truck.Value):Clone()
Truck.Name = Player.Name .. " Vehicle " --.. script.Parent.ToolName.Value
Truck.Parent = workspace
local CFrame = script.Parent.Spawn.CFrame
Truck:SetPrimaryPartCFrame(CFrame)
Truck:MakeJoints()
end
end
script.Parent.Activated:Connect(ActivateTool)
local Tool = script.Parent
Tool.Activated:Connect(function() -- this
print("test")
local Player = game.Players:GetPlayerFromCharacter(script.Parent.Parent) -- this
if workspace:FindFirstChild(Player.Name .. " Vehicle " ) then
else
local Truck = game.ServerStorage.SpawnableCars:FindFirstChild(script.Parent.Truck.Value):Clone()
Truck.Name = Player.Name .. " Vehicle " --.. script.Parent.ToolName.Value
Truck.Parent = workspace
local CFrame = script.Parent.Spawn.CFrame
Truck:SetPrimaryPartCFrame(CFrame)
Truck:MakeJoints()
end
end)
The script works just fine for me. Either you have the script in the wrong place, studio’s bugging, or maybe you aren’t activating the tool (reminder that the .Activated event only fires when the player clicks while the tool is equipped.)
Hmm i’ll try restarting my computer Nvermind i dont think it will work because it doesnt work in-game (like the actual roblox app) for my friends or me
Yes that’s it! but i still cant understand whats happening with my game. Its pretty big and has lots of unanchored parts so I don’t know if the game size or lag could be the problem though
Yea it only outputs “working”" i just tested the tool in a baseplate and it worked there too. I think it is my game thats the problem ill try to fix that Edit: fixed it! turns out it was a script, thanks for helping though