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

A bug that is annoying me a lot! Can someone help me?

Asked by 7 years ago

What I'm having a problem with is that I made a hammer that allows me to build fences, and so far I'm very happy with the progress! However when I tried it on a local server, it just refuses to work, even printing a string of words, you know, print("Something like this!"). I tried connecting it to the server with a RemoteEvent but it still doesn't work, only on the server! I have no idea why! I might just be blind and stupid but oh well.

I just can't seem to spot the fix. I'm also not sure if it's because of the tool itself or the scripts contained inside because I copied the exact tool but changed the script to just place a brick where you click in the workspace, it works like I expected it to without flaws. Be warned that the script you're about to see is long. 202 lines as of now.

THIS IS CLIENT SIDED!

001local plr = game.Players.LocalPlayer
002local tool = script.Parent
003 
004local mouse = plr:GetMouse()
005 
006local canSelectOption = true
007local canPlaceItem = false
008local isHoldingShift = false
009local isShowingCantPlace = false
010local isSetToGreen = true
011local toolIsEquipped = false
012 
013local previousAngle = 0
014 
015local originalPartColor = {}
View all 202 lines...

ATTENTION! Okay, now I've got your attention, I'm just telling you that the next script is server sided.

01script.Parent.Build.OnServerEvent:connect(function(plr, fenceSelected, originalPartColor, originalPartTransparency, originalPartMaterial)
02    for i = 1, #fenceSelected:GetChildren() do
03        local parts = fenceSelected:GetChildren()
04 
05        if parts[i]:IsA("BasePart") and parts[i].Name ~= "FenceCollision" then
06            parts[i].BrickColor = originalPartColor[i]
07            parts[i].Transparency = originalPartTransparency[i]
08            parts[i].Material = originalPartMaterial[i]
09        elseif parts[i]:IsA("BasePart") and parts[i].Name == "FenceCollision" then
10            parts[i].CanCollide = true
11        end
12    end
13end)
14 
15script.Parent.UpdateStats.OnServerEvent:connect(function(plr, stats, price, level)
View all 21 lines...
0
Any errors? hiimgoodpack 2009 — 7y
0
Nope, no errors at all. Server and client doesn’t show any errors. tobyjing2005 107 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Sorry guys, I fixed it. It's because I was trying to access the ServerStorage with a local script.

Ad

Answer this question