So what am I supposed to change? event:FireServer(mouse.Hit.Position) This? event.OnServerEvent:Connect(function(player, pos) bone:Clone() or this?
The first one only seems to work, while the 2nd one looks like it has to do with the wording for (player,pos).
If the event position has to do with the problem, tell me where to put it. If not, tell me what I need to change, because I do not know what to do and I’m not that experienced at all.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local bone = script.Parent.BoneSmash
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
script.Parent.Activated:Connect(function()
if mouse.Button1Down then
print(script.Parent:GetChildren())
local g = bone:Clone()
print("SENDING")
g.Parent = workspace
g.Script.Enabled = true
g.Position = mouse.Hit.Position + Vector3.new(0,80,0)
task.wait(0)-- Fire rate
end
end)
event:FireServer(mouse.Hit.Position)
This is my current code so far. Unless I had done something wrong, the same thing happened when I ran the game as I’ve said before.
Currently you’re only firing the server one time when the script starts. You need to move it to the function connected to activating your tool to make it fire when you use the tool.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local bone = script.Parent.BoneSmash
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
script.Parent.Activated:Connect(function()
if mouse.Button1Down then
print(script.Parent:GetChildren())
local g = bone:Clone()
print("SENDING")
g.Parent = workspace
g.Script.Enabled = true
g.Position = mouse.Hit.Position + Vector3.new(0,80,0)
task.wait(0)-- Fire rate
end
event:FireServer(mouse.Hit.Position)
end)
Tried this as well, but it doesn’t look like it changed anything either. Am I supposed to change the function at the start to connect with the tool, then modify event:FireServer(mouse.Hit.Position) to connect to the 2nd script? If not, tell me how am I supposed to do it, as I am in doubt of doing many things, such as creating another event assiociated with the server and renaming the functions to support a local tool = blah blah blah, etc.
Weird, could you add a print statement after that line and see if that prints? Also, the if mouse.Button1Down line is basically useless since it will always return true. Button1Down is an event, not a boolean, so you’re basically checking if the event exists.
If you are talking about event:FireServer(mouse.Hit.Position), when I put a print statement afterwards it did print but the remoteEvent, as I’ve said before, pretty self explanatory at this point. What I wanted didn’t happen.
There is no errors happening either. It might have to do with this line of code, event.OnServerEvent:Connect(function(player, pos) bone:Clone(). The server script is handling what the bone smash does after that point.
Yep, I know it’s handling that. The thing is, I don’t see anything that would cause it to not run. Do you mind sending a full screenshot of your output? From what I can tell it should be working.
Yes, from the very start when I showed the script heriarchy, the server script was intentionally disabled and enabled upon the localscript being triggered.
Yep just noticed the issue. Upset with myself for not noticing it before but I just did.
You’re enabling the script on the client. That doesn’t change anything since a server script is… well, a server script. Enabling it on a single client does nothing. Why does the script start as disabled in the first place?
Tried it without enabling. The script worked, however the original bone (The bone used to replicate more bones) will perform the script instead of the duplicated ones. That was the reason why I wanted it disabled and enabled in the first place.