Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Transferring parameters from client to server?

Asked by 5 years ago

Hi, I'm not exactly sure how to transfer parameters from the client to the server via Remote Events. I'm trying to create a laser gun and I pretty much followed the guide on the Roblox Dev website, but instead of using a Local Script I tried to use Remote Events. Here's what I have.

LocalScript:

01local tool = script.Parent
02local handle = tool:WaitForChild("Handle")
03local RS = game:GetService("ReplicatedStorage")
04local FlameEvent = RS:WaitForChild("FlameThrowEvent")
05 
06local player = game.Players.LocalPlayer
07local Mouse = player:GetMouse()
08local handlepos = handle.CFrame.p
09local mousepos = Mouse.hit.p
10 
11local debounce = false
12 
13 
14tool.Activated:connect(function()
15    if debounce == false then
View all 23 lines...

Server Script:

01local RS = game:GetService("ReplicatedStorage")
02local FireEvent = RS:WaitForChild("FlameThrowEvent")
03 
04local DebrisFolder = Instance.new("Folder")
05DebrisFolder.Parent = game.Workspace
06 
07function FireBlaze(player, start, finish)
08    local ray = Ray.new(start, (finish - start).unit * 300)
09    local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
10 
11    local flame = Instance.new("Part")
12    flame.Transparency = 0.5
13    flame.Anchored = true
14    flame.CanCollide = false
15    flame.Locked = true
View all 30 lines...

I don't get any errors, but it doesn't work as it's supposed to since the part just spawns at a random point on the map. Did I use the parameters wrong here, or is it something else?

Answer this question