local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
local bone = gs.BoneSmash
script.Parent.Activated:Connect(function()
print(script.Parent:GetChildren())
local g = bone:Clone()
print("SENDING")
g.Parent = workspace
g.Position = mouse.Hit.Position + Vector3.new(0,80,0)
task.wait(0)-- Fire rate
event:FireServer(mouse.Hit.Position)
print("FINISHED.")
end)
local player = game.Players.LocalPlayer
local bone = script.Parent
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
local boneSmash = script.Parent
local getPosition = boneSmash.CFrame
local sound = boneSmash["Undertale Notice"]
print(script.Parent:GetChildren())
event.OnServerEvent:Connect(function(player, pos) bone:Clone()
print("Started")
boneSmash.Transparency = 0
for i = 1,7 do
boneSmash.Position = boneSmash.Position + Vector3.new(0,1,0)
task.wait(0.06)
end
sound:Play()
task.wait(0.65)
for i = 1,8 do
boneSmash.Position = boneSmash.Position + Vector3.new(0,-10,0)
task.wait(0.06)
end
local explosion = game.ServerStorage.Explosion:clone()
explosion.Position = boneSmash.CFrame.Position + Vector3.new (0,-25,0)
explosion.Parent = workspace
explosion.KillScript.Enabled = true
explosion.Script.Enabled = true
for i = 1,15 do
boneSmash.Position = boneSmash.Position + Vector3.new(0,-1,0)
boneSmash.Transparency = i / 15
task.wait(0.05)
end
boneSmash.CFrame = getPosition
task.wait(0.05)
script.Parent:Destroy()
end)
Yep, another client-server networking thing I didnât notice earlier. Instead of modifying the bone in any way on the client, have the server script handle the bones in entirety. You could move the server script out of the bone and into the tool itself and just replace all mentions of bones specific to that tool to a cloned bone similar to what was being done on the client.
Tried it. This time, it only clones 1 and does that permanently.
local player = game.Players.LocalPlayer
local bone = script.Parent
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
local boneSmash = gs.BoneSmash
local sound = boneSmash["Undertale Notice"]
print(script.Parent:GetChildren())
event.OnServerEvent:Connect(function(player, pos) bone:Clone()
print("Started")
boneSmash.Transparency = 0
for i = 1,7 do
boneSmash.Position = boneSmash.Position + Vector3.new(0,1,0)
task.wait(0.06)
end
sound:Play()
task.wait(0.65)
for i = 1,8 do
boneSmash.Position = boneSmash.Position + Vector3.new(0,-10,0)
task.wait(0.06)
end
local explosion = game.ServerStorage.Explosion:clone()
explosion.Position = boneSmash.CFrame.Position + Vector3.new (0,-25,0)
explosion.Parent = workspace
explosion.KillScript.Enabled = true
explosion.Script.Enabled = true
for i = 1,15 do
boneSmash.Position = boneSmash.Position + Vector3.new(0,-1,0)
boneSmash.Transparency = i / 15
task.wait(0.05)
end
task.wait(0.05)
boneSmash:Destroy()
end)
This is the current script so far. What should I change?
I almost forgot to mention, print("Started") does it the moment the player joins the game, which means that there may be something with the remoteEvent code.
From the looks of it youâre just modifying the instance of boneSmash in ReplicatedStorage.
What do you mean by âit only clones 1 and does that permanentlyâ?
Could you send your current client script?
Sorry itâs taking so long to fix this Iâm actually tired as heck and Iâm trying my best lol.
The server script remains unchanged. The video already cut off but I can explain what happened. The explosion was displaced from the bone, meaning that there was still some unfinished work that needs to be fixed, either with the local script or serverscript.
I shouldnât have to repeat myself again. I have yet to get the desired result I want. Even when someone else tried to help me (by making it a remote function), nobody has managed to give a proper solution so far on making a tool that spawns a server attack from the playerâs cursor.
Ill give you the formula to make it.
from the local script - as soon as the player presses mouse1 you sent the server the position of his mouse with a remote event
from the server script - you get the position from the mouse and the player through the local script and spawn whatever you want to spawn there.
besides - this is your issue. We are here to help. You cannot condem us for not having given you what you want exactly after we tried.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
local bone = gs.BoneSmash
script.Parent.Activated:Connect(function()
print(script.Parent:GetChildren())
print("SENDING")
task.wait(0)-- Fire rate
event:FireServer(mouse.Hit.Position)
print("FINISHED.")
end)
local player = game.Players.LocalPlayer
local bone = script.Parent
local gs = game:GetService("ReplicatedStorage")
local event = gs.RemoteEvent
local boneSmash = gs.BoneSmash
local sound = boneSmash["Undertale Notice"]
print(script.Parent:GetChildren())
event.OnServerEvent:Connect(function(player, pos) bone:Clone()
print("Started")
local playerPosition = event.OnServerEvent:Connect(player:GetMouse())
local g = boneSmash:Clone()
g.Parent = workspace
playerPosition = g.Position + Vector3.new(0,80,0)
g.Transparency = 0
for i = 1,7 do
g.Position = g.Position + Vector3.new(0,1,0)
task.wait(0.06)
end
sound:Play()
task.wait(0.65)
for i = 1,8 do
g.Position = g.Position + Vector3.new(0,-10,0)
task.wait(0.06)
end
local explosion = game.ServerStorage.Explosion:clone()
explosion.Position = g.CFrame.Position + Vector3.new (0,-25,0)
explosion.Parent = workspace
explosion.KillScript.Enabled = true
explosion.Script.Enabled = true
for i = 1,15 do
g.Position = g.Position + Vector3.new(0,-1,0)
g.Transparency = i / 15
task.wait(0.05)
end
task.wait(0.05)
g:Destroy()
end)
This is the best I managed to get so far. For the 2nd script, the bone now fully appears for the server and duplicate infinitely but it stays locked into a single position and I have yet been able to figure out how the playerâs mouse position when they click, the bone that spawns will do itâs job at that location. The problem is, it has to do with this line of code, local playerPosition = event.OnServerEvent:Connect(player:GetMouse()) . Iâm not sure how I should rewrite this line of code.
I apologize for my rudeness. Itâs just that I havenât managed to get a proper solution yet and I already feel burnt out from trying to make new scripts, as everytime I do it I always run into one scenario: asking for help, which I then hope that anybody that replies and offers me the best solution but it seems here I ran into what feels like a dead end, where I just canât figure out what people are trying to tell me. Itâs just tiring me out and demotivating me from scripting.